<?php


class Programmation extends Entity { use ProgrammationView;
	
    //Nom de la table
    protected static $sql_table='programmation';
    //Colonne utilisée comme identifiant
    protected static $sql_id='PROG_NUMID';

    //Liste des colonnes de la table
    protected $PROG_NUMID;
    protected $FILM_NUMID;
    protected $CREN_NUMID;
    protected $SALL_NUMID;
    protected $PROG_DATE;
    protected $TYPE_NUMID;
    
    
    
    public function setDate($dateTexte){
        $this->PROG_DATE=$dateTexte;
    }
    
    
    public static function getProgsForThisMoment($jour, $creneau){
        $date=date('Y-m-d',$jour);
        $crenId=$creneau->getId();
        $table=self::$sql_table;
        $requete="SELECT * FROM $table WHERE PROG_DATE='$date' and CREN_NUMID='$crenId';";
        return self::populateList(Database::selectList($requete));
    }
    
    
    public static function getProgsForThisWeek($semaine){
        $debut=date('Y-m-d',$semaine['debut']);
        $fin=date('Y-m-d',$semaine['fin']);
        $table=self::$sql_table;
        $requete="SELECT * FROM $table WHERE PROG_DATE BETWEEN '$debut' and '$fin';";
        return self::populateList(Database::selectList($requete));
    }
    
    
}


?>